<?php if (!isset($v_sval)) 
		exit;

	$event_id = ( isset($_REQUEST['hdn_event_id']) ? $_REQUEST['hdn_event_id'] : 0);
	$event_title = ( isset($_REQUEST['event_title']) ? $_REQUEST['event_title'] : '');
	$event_date = ( isset($_REQUEST['event_date']) ? $_REQUEST['event_date'] : '');
	$event_time = ( isset($_REQUEST['event_time']) ? $_REQUEST['event_time'] : '');
	$event_detail = ( isset($_REQUEST['event_detail']) ? $_REQUEST['event_detail'] : '');
	
	if ( $event_date != '' ){
		$event_date = convertDatetoSQLDate($event_date);
	}
	
	if ($event_id){
		updateEvent($event_id,$event_title,$event_date,$event_time,$event_detail);
	}
	else{
		$event_id = insertEvent($event_title,$event_date,$event_time,$event_detail,$user_id);
	}
	
	if ($event_id){
		$_SESSION['error_message'] = '';
	}
	else{
		$_SESSION['error_message'] = _ERROR_MSG_ADD_NEW_EVENT;	
	}
	redir("?a=ACC&acc=USER&user=EVEN");
?>

